API Documentation
Static Public Member Functions | List of all members
nkAstraeus::lua::nkScriptsWrap::ScriptWrapper Class Referencefinal

Wraps a nkResources::ResourceManager and offer functions for use in scripting. More...

Static Public Member Functions

static void updateEnvironment (nkScripts::Environment *env)
 
static void * constructor (const nkScripts::DataStack &stack)
 
static void destructor (void *toDestroy)
 
static nkScripts::OutputValue getSources (void *data)
 
static void setSources (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue load (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue call (const nkScripts::DataStack &stack)
 

Detailed Description

Wraps a nkResources::ResourceManager and offer functions for use in scripting.

Member Function Documentation

◆ updateEnvironment()

static void nkAstraeus::lua::nkScriptsWrap::ScriptWrapper::updateEnvironment ( nkScripts::Environment env)
static

Updates a given environment and set it up to use all functions wrapped by this wrapper.

Parameters
envThe environment to set up.

◆ constructor()

static void* nkAstraeus::lua::nkScriptsWrap::ScriptWrapper::constructor ( const nkScripts::DataStack stack)
static

Wrapper function for the constructor of the user type.

local t = nkScripts.Script.new() ;
Parameters
stackThe parameter stack.
Returns
An output value with the user type and data allocated.

◆ destructor()

static void nkAstraeus::lua::nkScriptsWrap::ScriptWrapper::destructor ( void *  toDestroy)
static

Wrapper function for the destructor of the user type.

Parameters
toDestroyThe data that has to be freed.

◆ getSources()

static nkScripts::OutputValue nkAstraeus::lua::nkScriptsWrap::ScriptWrapper::getSources ( void *  data)
static

Wrapper function for the nkScripts::Script::getSources(), exposed as an attribute getter.

local d = t.sources ;
Parameters
dataThe data from which the attribute will be retrieved.
Returns
The attribute value, as a string.

◆ setSources()

static void nkAstraeus::lua::nkScriptsWrap::ScriptWrapper::setSources ( const nkScripts::DataStack stack)
static

Wrapper function for nkScripts::Script::setSources(), exposed as an attribute setter.

t.sources = "s = 0.5" ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ load()

static nkScripts::OutputValue nkAstraeus::lua::nkScriptsWrap::ScriptWrapper::load ( const nkScripts::DataStack stack)
static

Wrapper function for nkScripts::Script::load().

local t = s:load() ;
Parameters
stackThe parameter stack.
Returns
The output value.

◆ call()

static nkScripts::OutputValue nkAstraeus::lua::nkScriptsWrap::ScriptWrapper::call ( const nkScripts::DataStack stack)
static

Utility function to allow to call scripts and execute them.

nkScripts.call("scriptName") ;

This can be used to execute scripts from a script. If anything bad happens, the error will be logged from nkScripts::LogManager.

Parameters
stackThe parameter stack, with the name of the script to execute (string).
Returns
The output value, empty.

The documentation for this class was generated from the following file: